import Taro ,{Component} from '@tarojs/taro'
import {View, Image, Text} from '@tarojs/components'
import './index.scss'

export default class ChallengeCard extends Component {
  constructor(props) {
    super(props);
    this.state = {
      imageUrl: null,
    }
  }

  componentDidMount() {

  }

  render() {
    const {data} = this.props;
    if (data) {
      const sectionStyle = {
        backgroundImage: `url(${data.img})`,
      };
      return (
        <View className='challenge-card' style={ sectionStyle}>
          <View className='challenge-title'>
            <View className='challenge-title-name'>{data.topic}</View>
            <View className='challenge-period'>{data.period}</View>
          </View>
          <Text className='challenge-description'>{data.extra}</Text>
          <View className='total'>
            <Text className='person'>{data.totalPerson}</Text> 人参与，奖金池
            <Text className='money'>{data.totalMoney}</Text>元
          </View>
        </View>
      );
    }

  }
}
